#@weiXinLayout("登录界面")

#define weiXinMain()

<div class="loginFormContainer">
    <div style="text-align: center">
        <h1 class="title">多克旅行</h1>
        <p style="margin-top:25px; color: #6C3428">人生就是要多走一些路，多看一些风景！！</p>
        #--
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" id="mobile" type="text" placeholder="请输入用户手机号...">
                </div>
            </div>
        </div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" type="password" id="password" type="text" placeholder="请输入用户密码...">
                </div>
            </div>
        </div>
        <div style="margin-top:20px;">
            <a href="javascript:;" id="loginBtn"class="weui-btn weui-btn_primary">登录系统</a>
        </div>
        --#
        <div style="margin-top:40px;">
            <a href="javascript:;" id="wxLoginBtn"class="weui-btn weui-btn_primary">使用微信登录</a>
        </div>
    </div>
    <!--<a href="javascript:;" id="sendCode"class="weui-btn weui-btn_primary">发送验证码</a>-->
</div>


#end

#define weiXinCss()
<style>
    .loginFormContainer{
        height: 100%;
        justify-content: center;
        margin: 80px;
    }
    .title{
        color: #6C3428;
    }

    .wx-login{
        margin-top:80px;
        color: white;
    }

    body {
        height: 100%;
        width: 100%;
        background: url('#(contextPath)/assets/front/img/wx-login-bg.jpeg') no-repeat center center fixed;
        background-size:cover;
    }
</style>

#end

#define weiXinJs()
<script>
$(document).ready(function(){
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return "";
    }

    $("#wxLoginBtn").click(function(){
        var redirectURI="#(redirectUrl)";
        redirectURI = encodeURIComponent(redirectURI);
        window.location.href= "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxeb8c418a7652a002&redirect_uri="+redirectURI+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
    });

    $("#loginBtn").click(function(){
        var config ={
            "url":"#(contextPath)/weixin/doLogin",
            "data":{
                "mobile":$("#mobile").val(),
                "password":$("#password").val()
            },
            "successCallBack":function(resp){
                if(resp.result){
                    var returnUrl = getQueryString("returnUrl");
                    returnUrl = decodeURIComponent(returnUrl)
                    if(returnUrl!=""){
                        window.location.href=returnUrl;
                    }else{
                        window.location.href="#(contextPath)/weixin/"
                    }
                }else{
                    $.alert(resp.data);
                }
            }
        }
        var ajax = new AjaxUtils(config);
        ajax.executeRequest();
    });
});
</script>
#end